package com.billlv.codegenerator.mapper;

import com.billlv.codegenerator.domain.dto.DatabaseConnectionDTO;
import com.billlv.codegenerator.domain.entity.DatabaseConnectionEntity;
import com.billlv.codegenerator.domain.vo.DatabaseConnectionVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.mapstruct.MappingTarget;

import java.util.List;

/**
 * Mapper interface for converting DatabaseConnection entities to DTOs and VOs, and vice versa.
 */
@Mapper
public interface DatabaseConnectionMapper {

    /**
     * Get the Mapper instance.
     */
    DatabaseConnectionMapper INSTANCE = Mappers.getMapper(DatabaseConnectionMapper.class);

    /**
     * Convert Entity to DTO.
     *
     * @param entity the DatabaseConnection entity
     * @return the corresponding DatabaseConnection DTO
     */
    DatabaseConnectionDTO toDTO(DatabaseConnectionEntity entity);

    /**
     * Convert DTO to Entity.
     *
     * @param dto the DatabaseConnection DTO
     * @return the corresponding DatabaseConnection entity
     */
    DatabaseConnectionEntity toEntity(DatabaseConnectionDTO dto);

    /**
     * Convert Entity to VO.
     *
     * @param entity the DatabaseConnection entity
     * @return the corresponding DatabaseConnection VO
     */
    DatabaseConnectionVO toVO(DatabaseConnectionEntity entity);

    /**
     * Convert VO to Entity.
     *
     * @param vo the DatabaseConnection VO
     * @return the corresponding DatabaseConnection entity
     */
    DatabaseConnectionEntity toEntityFromVO(DatabaseConnectionVO vo);

    void updateEntityFromDTO(DatabaseConnectionDTO dto, @MappingTarget DatabaseConnectionEntity entity);


    /**
     * Convert a list of Entities to a list of DTOs.
     *
     * @param entities the list of DatabaseConnection entities
     * @return the corresponding list of DatabaseConnection DTOs
     */
    List<DatabaseConnectionDTO> toDTOList(List<DatabaseConnectionEntity> entities);

    /**
     * Convert a list of DTOs to a list of Entities.
     *
     * @param dtos the list of DatabaseConnection DTOs
     * @return the corresponding list of DatabaseConnection entities
     */
    List<DatabaseConnectionEntity> toEntityList(List<DatabaseConnectionDTO> dtos);

    /**
     * Convert a list of Entities to a list of VOs.
     *
     * @param entities the list of DatabaseConnection entities
     * @return the corresponding list of DatabaseConnection VOs
     */
    List<DatabaseConnectionVO> toVOList(List<DatabaseConnectionEntity> entities);

    /**
     * Convert a list of VOs to a list of Entities.
     *
     * @param vos the list of DatabaseConnection VOs
     * @return the corresponding list of DatabaseConnection entities
     */
    List<DatabaseConnectionEntity> toEntityListFromVO(List<DatabaseConnectionVO> vos);
}
